#pragma once
#include "mkvstream.hpp"
#include <mmreg.h>
//#include <list>

namespace MkvMux
{

struct Cluster;

class MkvStreamAudio : public MkvStream
{
    MkvStreamAudio(const MkvStreamAudio&);
    MkvStreamAudio& operator=(const MkvStreamAudio&);

protected:    
    MkvStreamAudio(MkvContext&, const BYTE*, ULONG);

    void WriteTrackType();
    void WriteTrackSettings();
    
    const void* GetFormat(ULONG&) const;
    
    virtual ULONG GetSamplesPerSec() const = 0;
    virtual BYTE GetChannels() const = 0;

public:
    ~MkvStreamAudio();
    
    void Flush();
    bool Wait() const;

    class AudioFrame : public Frame
    {
        AudioFrame(const AudioFrame&);
        AudioFrame& operator=(const AudioFrame&);

    protected:
        AudioFrame();
        
    public:
        void Write(const MkvStream&, ULONG cluster_timecode_ms) const;

    };      

    typedef std::list<AudioFrame*> frames_t;    
    frames_t& GetFrames();

private:
    void* const m_pFormat;
    const ULONG m_cFormat;
    frames_t m_frames;
    
};

}  //end namespace MkvMux
